<?php defined('IN_IA') or exit('Access Denied');?><?php (!empty($this) && $this instanceof WeModuleSite || 1) ? (include $this->template('public/header', TEMPLATE_INCLUDEPATH)) : (include template('public/header', TEMPLATE_INCLUDEPATH));?>
<?php (!empty($this) && $this instanceof WeModuleSite || 1) ? (include $this->template('public/comhead', TEMPLATE_INCLUDEPATH)) : (include template('public/comhead', TEMPLATE_INCLUDEPATH));?>
<link rel="stylesheet" type="text/css" href="../addons/yzzc_sun/template/public/ygcss.css">
<style type="text/css">
    .store_list_img{width: 40px;height: 40px;background-color: pink;}
    .yg5_tabel{border: none;outline: none;}
    .yg5_tr3>td{border-bottom: 1px solid #efefef;padding: 5px 0px;text-align: center;}
    .yg5_tr4>td{border-bottom: 1px solid #efefef;padding: 5px 0px;text-align: center;}
    .yg5_tr2>td{padding: 10px 0px;border-bottom: 1px solid #efefef;text-align: center;
        /*background-color: #EDF6FF;*/

    }
    .yg5_tr1{border-bottom: 1px solid #efefef;font-weight: bold;text-align: center;
    }
    .fenleilist1{height: 35px;line-height: 35px;}
    .yg5_tr3>td:nth-child(1),.yg5_tr1>td:nth-child(1){width: 80px;text-align: center;}
    .yg5_tr3>td:nth-child(2),.yg5_tr1>td:nth-child(2){width: 80px;}
    .yg5_tr3>td:nth-child(3),.yg5_tr1>td:nth-child(3){width: 120px;}
    .yg5_tr3>td:nth-child(4),.yg5_tr1>td:nth-child(4){width: auto;}
    .yg5_tr3>td:nth-child(5),.yg5_tr1>td:nth-child(5){width: 100px;}
    .yg5_tr3>td:nth-child(6),.yg5_tr1>td:nth-child(6){width: 100px;}
    .yg5_tr3>td:nth-child(7),.yg5_tr1>td:nth-child(7){width: auto;}
    .yg5_tr3>td:nth-child(8),.yg5_tr1>td:nth-child(8){width: 80px;}
    .yg5_tr3>td:nth-child(4){padding-left: 30px;}
    .yg5_tr3:hover{background-color: #EDF6FF;}
    .yg5_tr2:hover{background-color: #EDF6FF;}
    .fxiala{font-size: 16px;cursor: pointer;opacity: 0.5;display: inline-block;width: 50px;height: 20px;text-align: center;}
    .fxiala:hover{color: #333;opacity: 1;}
    .collapse{transition: all 0.5s;}
    .ygsave{margin-top: 50px;}
    .storespan2{font-size: 14px;color: white;margin: 5px;position: relative;background-color: #444444;}
    .storespan2:hover{color: #fff;}
    .storespan2:hover .bianji{display: block;}
    .feileibqbox{position: relative;margin-right: 15px;display: inline-block;padding: 5px;}
    .feileibq2{position: absolute;top: -5px;right: -5px;cursor: pointer;}
    .feileibq2>img{width: 25px;height: 25px;}
    .feileibqremark{width: 80px;height: 20px;}
    .storegrey3{width: 120px;height: 35px;padding: 0px 10px;border-radius: 10px;text-align: center;outline: none;}
    .xgsuccess{position: absolute;top: 17%;left: 0%;z-index: 1080;display: none;}
</style>
<ul class="nav nav-tabs">
    <span class="ygxian"></span>
    <div class="ygdangq">当前位置:</div>
    <li class="active"><a href="javascript:void(0);">租车券列表</a></li>
</ul>
<div class="main">
    <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data" id="invitative">
        <div class="panel panel-default ygdefault">
            <div class="panel-heading wyheader">
                <a href="<?php  echo $this->createWebUrl('rentings', array('type2_id' => $son['id']))?>" class="storespan2 btn btn-xs">
                    <span class="fa fa-plus"></span>添加租车券
                         <span class="bianji" style="left: 15px;">添加租车券
                        <span class="arrowdown"></span>
                    </span>
                </a>
                <a href="<?php  echo $this->createWebUrl('rentrule')?>" class="storespan2 btn btn-xs">
                    <span class="fa fa-plus"></span>添加租车券使用说明
                    <span class="bianji" style="left: 15px;">添加租车券使用说明
                        <span class="arrowdown"></span>
                    </span>
                </a>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    租车券列表
                </div>
                <div class="panel-body" style="padding: 0px 15px;">
                    <div class="row">
                        <table class="yg5_tabel col-md-12">
                            <tr class="yg5_tr1">
                            <td class="fenleilist1">标题</td>
                            <td style="text-align: center;width: 200px;">内容</td>
                            <td style="text-align: center;">开始时间</td>
                            <td style="text-align: center;">结束时间</td>
                            <td style="text-align: center;">创建时间</td>
                            <td>已领/总数</td>
                            <td>所需积分</td>
                            <td>状态</td>
                            <td>操作</td>
                        </tr>
                        <?php  if(is_array($info)) { foreach($info as $row) { ?>
                        <tbody>
                        <tr class="yg5_tr2">
                            <td><?php  echo $row['title'];?></td>
                            <td>
                                满<?php  echo $row['full'];?>元立减<?php  echo $row['money'];?>元
                            </td>
                            <td><?php  echo $row['start_time'];?></td>
                            <td><?php  echo $row['end_time'];?></td>
                            <td><?php  echo $row['createtime'];?></td>
                            <?php  if($row['total']==0) { ?>
                            <td><?php  echo $row['getnum'];?> / 不限量</td>
                            <?php  } else { ?>
                            <td><?php  echo $row['getnum'];?> / <?php  echo $row['total'];?></td>
                            <?php  } ?>
                            <td><?php  echo $row['score'];?></td>
                            <td>
                                <?php  if($row['status']==1) { ?>
                                    已启用
                                <?php  } else { ?>
                                    已禁用
                                <?php  } ?>
                            </td>
                            <td>
                                <?php  if($row['status']==1) { ?>
                                <a href="<?php  echo $this->createWebUrl('renting', array('id' => $row['id'],'op'=>change,'status'=>0))?>">
                                    <span class="btn btn-md ygyouhui2">点击禁用</span>
                                </a>
                                <?php  } else { ?>
                                <a href="<?php  echo $this->createWebUrl('renting', array('id' => $row['id'],'op'=>change,'status'=>1))?>">
                                    <span class="btn btn-md storegrey2">点击启用</span>
                                </a>
                                <?php  } ?>
                                <a href="<?php  echo $this->createWebUrl('getcouponlog',array('type'=>1,'cid'=>$row['id']));?>"> <span class="btn btn-md ygyouhui2">查看领取记录</span></a>
                                <a href="<?php  echo $this->createWebUrl('rentings', array('id' => $row['id']))?>" class="storespan btn btn-xs">
                                    <span class="fa fa-pencil"></span><span class="bianji">编辑<span class="arrowdown"></span></span>
                                </a>

                                <a href="javascript:;" class="storespan btn btn-xs" onclick="delrenting(<?php  echo $row['id'];?>)">
                                    <span class="fa fa-trash-o"></span><span class="bianji">删除<span class="arrowdown"></span></span>
                                </a>
                            </td>
                        </tr>
                        </tbody>
                        <?php  } } ?>
                    </table>
                </div>
            </div>

        </div>
    </form>
</div>
<script type="text/javascript">
    $(function(){
        $("#frame-9").show();
        $("#yframe-9").addClass("wyactive");

    })

    function delrenting(id) {
        var ret = confirm("您确定删除吗？")
        if (ret==true){
            $.ajax({
                type:"POST",
                url:"<?php  echo $this->createWebUrl('renting',array('op'=>delete))?>",
                dataType:"JSON",
                data:{id:id},
                success:function(res){
                    console.log(res);
                    location.reload();
                    // if(res.status == 1) {
                    //     layer.msg(res.message, {icon: 1});
                    //     location.href ="<?php  echo $this->createWebUrl('renting')?>";
                    // }else{
                    //     layer.msg(res.message, {icon: 6});
                    //     location.href =res.url;
                    // }
                }
            })
        }
    }
</script>